﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="Method"
	type="http://metalx.org/Class/Method"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:lst="http://metalx.org/i386/Functions/List"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:asc="http://metalx.org/Ansi/Ascii"
	xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:index="http://metalx.org/Intel/80386/Index"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands">
	
	<var:string id="parameter">http://metalx.org/Class/Parameter</var:string>
	<var:string id="parameterList">http://metalx.org/Class/ParameterList</var:string>

	<cls:method name="GetName" type="http://metalx.org/String">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<clsf:GetMethodName/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetType" type="http://metalx.org/String">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<clsf:GetMethodType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetParameters" type="http://metalx.org/Class/ParameterList">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<clsf:GetMethodParameters/>

		<cpu:PushSIToStack/>

		<lst:GetLength/>

		<!--Create List-->
		<lst:Create/>

		<cpu:PushDIToStack/>

		<!--Find Class-->
		<cpu:CopyImmediateToDI/>
		<addressOf ref="parameter" type="Absolute32"/>

		<sys:GetCatalog/>

		<cat:FindType/>

		<cpu:PushSIToStack/>

		<!--Create Objects-->
		<cpu:CopyOperandToRegister/>
		<op:SI-IndexAddressPlusImmediate8/>
		<index:SP/>
		<byte>8</byte>

		<cpu:CopyOperandToRegister/>
		<op:DI-IndexAddressPlusImmediate8/>
		<index:SP/>
		<byte>4</byte>

		<cpu:CopySIAddressToAXAndIncrementSI/>
		<cpu:CopyAXToDIAddressAndIncrementDI/>

		<cpu:CopyRegisterToOperand/>
		<op:AX-CXRegister/>

		<cpu:BranchToRelative8IfCXIsZero/>
		<addressOf ref="createListObject" type="Relative8"/>

		<label id="nextItem"/>

		<cpu:CopySIAddressToAXAndIncrementSI/>

		<cpu:PushSIToStack/>
		<cpu:PushDIToStack/>

		<cpu:CopyRegisterToOperand/>
		<op:AX-DIRegister/>

		<cpu:CopyOperandToRegister/>
		<op:BX-IndexAddressPlusImmediate8/>
		<index:SP/>
		<byte>8</byte>

		<obj:Create length="8"/>

		<cpu:CopyRegisterToOperand/>
		<op:DI-AXRegister/>

		<cpu:PullDIFromStack/>
		<cpu:PullSIFromStack/>

		<cpu:CopyAXToDIAddressAndIncrementDI/>

		<cpu:LoopToRelative8/>
		<addressOf ref="nextItem" type="Relative8"/>

		<!--Create List Object-->
		<label id="createListObject"/>

		<cpu:CopyOperandToRegister/>
		<op:DI-IndexAddressPlusImmediate8/>
		<index:SP/>
		<byte>4</byte>

		<cpu:CopyOperandToRegister/>
		<op:AX-DIAddress/>

		<cpu:IncrementAX/>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterLeft/>
		<byte>2</byte>

		<obj:Create type="http://metalx.org/Class/ParameterList"/>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:AddToSPRegister/>
		<byte>12</byte>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="Execute" type="http://metalx.org/Object">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<clsf:ExecuteMethod/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<clsf:GetMethodName/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class" static="true">
		<cpu:CopyRegisterToOperand/>
		<op:BX-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
</cls:class>